# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         translate和maketrans方法
# Description:
# Author:       asus
# Date:         2019/3/5
#-------------------------------------------------------------------------------


s = "I not only like python , but also like kotlin"
#创建一张替换表
table = s.maketrans("ak","*s")
print(table)
#在控制台输出替换表，运行结果：{97：42，107：36}
print(len(table))
#根据替换表替换s中相应的字符
print(s.translate(table))
#创建另外一个替换表，maketrans的第三个参数指定要删除的字符
table1 = s.maketrans("ak","*s"," ")
print(s.translate(table1))